package com.luo.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.luo.ssm.entity.SysFolder;
import com.luo.ssm.mapper.SysFolderMapper;
import com.luo.ssm.service.SysFolderService;
import com.luo.ssm.vo.FolderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : luocheng
 * @date : Created in 2021/8/28 23:13
 * @description :
 */
@Service
public class SysFolderServiceImpl implements SysFolderService {
    @Autowired
    private SysFolderMapper sysFolderMapper;

    @Override
    public int addNewFolderInfo(FolderVo folderVo) {
        int i = sysFolderMapper.insertNewFolderInfo(folderVo);
        return i;
    }

    @Override
    public PageInfo<SysFolder> getAllFolder(FolderVo folderVo, int pageNum, int pageSize) {
        //开启分页插件
        PageHelper.startPage(pageNum,pageSize);
        List<SysFolder> allFolder = sysFolderMapper.selectAllFolder(folderVo);
        PageInfo<SysFolder> pageInfo = new PageInfo<>(allFolder);
        return pageInfo;
    }
}
